package com.iris.live.services.data.models;

import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;

/**
 * @author: wangzhenyan
 * date: 2017/8/23 10:11
 */
public class PermitCodeModelPK implements Serializable {
    private String permit;
    private String code;

    @Column(name = "permit", nullable = false, length = 50)
    @Id
    public String getPermit() {
        return permit;
    }

    public void setPermit(String permit) {
        this.permit = permit;
    }

    @Column(name = "code", nullable = false, length = 50)
    @Id
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PermitCodeModelPK that = (PermitCodeModelPK) o;

        if (permit != null ? !permit.equals(that.permit) : that.permit != null) return false;
        if (code != null ? !code.equals(that.code) : that.code != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = permit != null ? permit.hashCode() : 0;
        result = 31 * result + (code != null ? code.hashCode() : 0);
        return result;
    }
}
